<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>     

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="<s:url value="/css/common.css"/>" type="text/css"
	rel="stylesheet" />

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.9.1.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>

<style type="text/css">

.error {
	color: red;
}

</style>
<script type="text/javascript">

	$(document).ready(function() {
		 $(":input[name=athorityValue]").each(function(){
			 	var aVal=$(this).val();
			 	for(var i=0 ;i<9;i++){
			 		var objVal=$(":checkbox[name='profitModule.proList["+i+"].mccTypeCode']").val();
			 		if(objVal==aVal){
			 			$(":checkbox[name='profitModule.proList["+i+"].mccTypeCode']").attr('checked',true);
			 		}
			 	}
			 	 /* $(":checkbox[name=transTypes]").each(function(){
			 		var moduleval=$(this).val();
			 		if(aVal==moduleval){
			 			$(this).attr('checked',true);
			 			
			 		}
			 	}); */
		 	  
		 	});
		//$("input").val("12");
		var mydate=new Date();
		var y=mydate.getFullYear();
		var m=mydate.getMonth()+1; 
		if(m<10){
		   m="0"+m
		}
		var d=mydate.getDate();
		if(d<10){
		   d="0"+d
		}
		$("#curDate").val(y+"-"+m+"-"+d);      

		// 字符最大长度验证（一个中文字符长度为2）
		jQuery.validator.addMethod("stringMaxLength", function(value,element, param) {
			var length = value.length;
			for ( var i = 0; i < value.length; i++) {
				if (value.charCodeAt(i) > 127) {
					length++;
				}
			}
			return this.optional(element) || (length <=param);
		}, $.validator.format("长度不能大于{0}!"));

		// 字符最大长度验证（一个中文字符长度为2）
		jQuery.validator.addMethod("maxNumber", function(value,element, param) {
			// param[0] 整数最大长度,param[1] 小数点最大长度
			var reg = new RegExp('^(\\d{0,' + param[0] + '})$');
			
			// 如果文本值包含小数点
			if(value.indexOf(".") != -1){
				reg = new RegExp('^(\\d{0,' + param[0] + '})' + '\\.?\\d{1,' + param[1] +'}$');
			}
			return reg.test(value);
		}, $.validator.format("请填写整数最长{0}位，小数最长{1}位的值"));
		$("#profitModuleForm").validate({
			debug : true,
			submitHandler : function(form) {
				var err = limitAmt();
				var errFee = limitFee();
				if (errFee != null && errFee != "") {
					alert(errFee);
				} else if (err != null && err != "") {
					alert(err);
				}else{
					form.submit();
				}
			},
			rules : {
				"profitModule.moduleName" : {required : true,maxlength:60},
				"profitModule.remark" : {required : false,stringMaxLength:240},

				"profitModule.proList[0].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[0].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[0].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[0].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},

				"profitModule.proList[1].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[1].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[1].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[1].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"profitModule.proList[2].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[2].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[2].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[2].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"profitModule.proList[3].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[3].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[3].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"profitModule.proList[3].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"agent.proList[4].profitFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[4].maxFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[4].profitSettleRate" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				"agent.proList[4].merchantMinFee" : {required : false,stringMaxLength:12,maxNumber:[7,4]},
				
				"profitModule.profitPerList[0].limitAmt" : {required : true,stringMaxLength:15,maxNumber:[12,2]},
				"profitModule.profitPerList[0].maxAmt" : {required : true,stringMaxLength:15,maxNumber:[12,2]},
				"profitModule.profitPerList[0].percent" : {required:true,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}},

				"profitModule.profitPerList[1].limitAmt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				"profitModule.profitPerList[1].maxAmt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
		        "profitModule.profitPerList[1].percent" : {required:false,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}},

				 "profitModule.profitPerList[2].limitAmt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				 "profitModule.profitPerList[2].maxAmt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
                 "profitModule.profitPerList[2].percent" : {required:false,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}},
														
				 "profitModule.profitPerList[3].limitAmt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},
				 "profitModule.profitPerList[3].maxAmt" : {required : false,stringMaxLength:15,maxNumber:[12,2]},		
				 "profitModule.profitPerList[3].percent" : {required:false,stringMaxLength:12,isDecimal: function(){
														var min = 0;
														var max = 100;
														var accuracy = 0;
														return [min, max, accuracy];}}	,	

			},
			messages : {
				"profitModule.moduleName" : {required : "必填",maxlength:"输入长度最多是 {0} 的字符串"},

				"profitModule.profitPerList[0].limitAmt" : {required : "必填",digits: "只能输入整数"},
				"profitModule.profitPerList[0].maxAmt" : {required : "必填",digits: "只能输入整数"},
				
				"profitModule.profitPerList[0].percent" : {required : "必填",isDecimal : "分润比例只能是0-100的数字"},
				
				"profitModule.profitPerList[1].limitAmt" : {digits: "只能输入整数"},
				"profitModule.profitPerList[1].maxAmt" : {digits: "只能输入整数"},
				"profitModule.profitPerList[1].percent" : {isDecimal : "分润比例只能是0-100的数字"},

				"profitModule.profitPerList[2].limitAmt" : {digits: "只能输入整数"},
				"profitModule.profitPerList[2].maxAmt" : {digits: "只能输入整数"},
				"profitModule.profitPerList[2].percent" : {isDecimal : "分润比例只能是0-100的数字"},

				"profitModule.profitPerList[3].limitAmt" : {digits: "只能输入整数"},
				"profitModule.profitPerList[3].maxAmt" : {digits: "只能输入整数"},
				"profitModule.profitPerList[3].percent" : {isDecimal : "分润比例只能是0-100的数字"}
				
			},errorPlacement: function(error, element) { 
			    if ( element.is(":radio") ) 
			        error.appendTo ( element.parent() ); 
			    else if ( element.is(":checkbox") ) 
			        error.appendTo ( element.parent() ); 

			    else if ( element.is("input") ) {
			    	var name = element[0].name;
			    	if( name == "profitModule.remark" ){
				        error.appendTo ( element.parent().parent() ); 
			    	}else if(name.indexOf("profitFee") != -1 || name.indexOf("maxFee") != -1 || name.indexOf("profitSettleRate") != -1 
			    			|| name.indexOf("merchantMinFee") != -1 || name.indexOf("limitAmt") != -1 || name.indexOf("maxAmt") != -1 
			    			|| name.indexOf("percent") != -1){

				        error.appendTo ( element.parent() ); 
			    	}else{
				    	error.appendTo ( element.parent().next() );
			    	}
			    }
			    else 
			        error.insertAfter(element); 
			} 

		});
		
	});
	
	function choiseValue(value,index){
	
		var parName = "profitModule.proList["+index+"].isCheck";
		var isCheckList = document.getElementsByName(parName);
		var isCheck = isCheckList[0].value;
		if(value == true){
		  document.getElementsByName(parName)[0].value = "1";
		}else{
		  document.getElementsByName(parName)[0].value = "0";
		}
	
	}
	

	function limitFee(){
		var checkBox = $('#tabBody').find(":checkbox:checked");

		var profitFeeFmt = "input[name='profitModule.proList[t_index].profitFee']";
		var maxFeeFmt = "input[name='profitModule.proList[t_index].maxFee']";
		var profitSettleRateFmt = "input[name='profitModule.proList[t_index].profitSettleRate']";
		var merchantMinFeeFmt = "input[name='profitModule.proList[t_index].merchantMinFee']";
		
		if(null != checkBox && checkBox.length > 0){
			
			for (var s = 0; s < checkBox.length; s++){
				
	   			var tId = checkBox[s].name;
	   			var v_id = checkBox[s].value;
	   			var feeName = getFeeName( v_id );
	   			
	   			var index = tId.split("[")[1].split("]")[0];

				var profitFeeStr = profitFeeFmt.replace("t_index",index);
				var maxFeeStr = maxFeeFmt.replace("t_index",index);
				var profitSettleRateStr = profitSettleRateFmt.replace("t_index",index);
				var merchantMinFeeStr = merchantMinFeeFmt.replace("t_index",index);
				
				var profitFee = $(profitFeeStr).val();
				var maxFee = $(maxFeeStr).val();
				var profitSettleRate = $(profitSettleRateStr).val();
				var merchantMinFee = $(merchantMinFeeStr).val();
	   			
				var isReadonly = $(maxFeeStr).attr("readOnly");
				var seetleRate_isReadonly = $(profitSettleRateStr).attr("readOnly");
				var minFee_isReadonly = $(merchantMinFeeStr).attr("readOnly");

				if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) <= 0  ) {
					return feeName + " 借记卡成本扣率 不能为空或为0.";
				}
				if(isReadonly == undefined){

					if( $.trim( maxFee) == null || $.trim( maxFee) == "" || parseFloat( $.trim( maxFee ) ) <= 0  ) {
						return feeName + " 借记卡封顶成本金额 不能为空或为0.";
					}
				}
				if(seetleRate_isReadonly == undefined){
					if( $.trim( profitSettleRate) == null || $.trim( profitSettleRate) == "" || parseFloat( $.trim( profitSettleRate)) <= 0  ) {
						return feeName + " 贷记卡成本扣率 不能为空或为0.";
					}
				}
				if(minFee_isReadonly == undefined){
					if( $.trim( merchantMinFee ) == null || $.trim( merchantMinFee ) == "" || parseFloat( $.trim( merchantMinFee ) ) <= 0  ) {
						return feeName + " 贷记卡最低签扣 不能为空或为0.";
					}
				}
				
				var cloudflashpay_fee = 0.28;
				
				// 如果是云闪付，默认 费率 为0.28
				if( null != v_id && "" != v_id && v_id == "05" ){

					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) != cloudflashpay_fee  ) {
						return feeName + " 借记卡成本扣率 只能等于 " + cloudflashpay_fee + ".";
					}
					if( $.trim( profitSettleRate) == null || $.trim( profitSettleRate) == "" || parseFloat( $.trim( profitSettleRate)) != cloudflashpay_fee  ) {
						return feeName + " 贷记卡成本扣率 只能等于  " + cloudflashpay_fee + ".";
					}
					if( $.trim( merchantMinFee ) == null || $.trim( merchantMinFee ) == "" || parseFloat( $.trim( merchantMinFee ) ) != cloudflashpay_fee  ) {
						return feeName + " 贷记卡最低签扣 只能等于  " + cloudflashpay_fee + ".";
					}
				}
				var unionpay_everyday_fee = 0.5025;

				// 如果是银联扫码（非优惠），默认 费率 不低于 0.5025
				if( null != v_id && "" != v_id && v_id == "06" ){
					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) < unionpay_everyday_fee  ) {
						return feeName + " 借记卡成本扣率 不能低于 " + unionpay_everyday_fee + ".";
					}
				}
				var unionpay_uneveryday_fee = 0.2;
				
				// 如果是银联扫码（优惠），默认 费率 不低于 0.2
				if( null != v_id && "" != v_id && v_id == "07" ){
					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) < unionpay_uneveryday_fee  ) {
						return feeName + " 借记卡成本扣率 不能低于 " + unionpay_uneveryday_fee + ".";
					}
				}
				var min_alipay_fee = 0.25;
				var max_alipay_fee = 0.35;
				// 如果是支付宝微信扫码，默认 费率 只能是 0.25-0.35 之间
				if( null != v_id && "" != v_id && v_id == "08" ){
					if( $.trim( profitFee) == null || $.trim( profitFee) == "" || parseFloat( $.trim( profitFee ) ) < min_alipay_fee  
						 || parseFloat( $.trim( profitFee ) ) > max_alipay_fee  ) {
						return feeName + " 借记卡成本扣率 只能是 " + min_alipay_fee + "-" + max_alipay_fee + " 之间.";
					}
				}
			}
		}else{
			return "至少配置一条扣率信息!";
		}
	}

	
	function limitAmt(){
		var limitAmtFmt = "input[name='profitModule.profitPerList[t_index].limitAmt']";
		var maxAmtFmt = "input[name='profitModule.profitPerList[t_index].maxAmt']";
		var percentFmt = "input[name='profitModule.profitPerList[t_index].percent']";
			 
		var arr = [];
		var l = 0;
		for(var i = 0; i<4; i++){
			var limitAmtStr = limitAmtFmt.replace("t_index",i);
			var maxAmtStr = maxAmtFmt.replace("t_index",i);
			var percentStr = percentFmt.replace("t_index",i);
			
			var limitAmt = $(limitAmtStr).val();
			var maxAmt = $(maxAmtStr).val();
			var percent = $(percentStr).val();
			
			if( ($.trim(limitAmt) != null && $.trim(limitAmt) != "") 
					|| ($.trim(maxAmt) != null && $.trim(maxAmt) != "") 
					|| ($.trim(percent) != null && $.trim(percent) != "") ){

				if( ($.trim(limitAmt) == null || $.trim(limitAmt) == "") ){
					return "第" + (i + 1) + "行区间最小金额不能为空.";
				}/* else if( ($.trim(maxAmt) == null || $.trim(maxAmt) == "") ){
					return "第" + (i + 1) + "行区间最大金额不能为空.";
				} */else if( ($.trim(percent) == null || $.trim(percent) == "") ){
					return "第" + (i + 1) + "行分润比例不能为空.";
				}else if( parseFloat($.trim(percent)) <= 0 ){
					return "第" + (i + 1) + "行分润比例必须大于0";
				}else{
					var row = [$.trim(limitAmt),$.trim(maxAmt),$.trim(percent),(i+1)];
					arr[l] = row;
					l++;
				}
			}
		}
		if(arr.length > 1){
			for(var s = 1; s < arr.length ; s++){
				var row1 = arr[s-1];
				var row2 = arr[s];
				// 如果不是最后一行,且 区间最大金额为空     注:最后一行的 区间最大金额 可以为空
				if(s < (arr.length-1) && ( $.trim(row2[1]) == null || $.trim(row2[1]) == "" )  ){
					return "第" + (row2[3]) + "行区间最大金额不能为空.";
				}
				
				if( parseFloat($.trim(row1[0])) >= parseFloat($.trim(row2[0])) ){
					return "第" + (row2[3]) + "行的区间最小金额 必须大于 第" + row1[3] + "行的区间最小金额." ;
				}
				if( $.trim(row2[1]) != null && $.trim(row2[1]) != "" ){
					if( parseFloat($.trim(row1[1])) >= parseFloat($.trim(row2[1])) ){
						return "第" + (row2[3]) + "行的区间最大金额 必须大于 第" + row1[3] + "行的区间最大金额." ;
					}
				}
				if( parseFloat($.trim(row1[2])) >= parseFloat($.trim(row2[2])) ){
					return "第" + (row2[3]) + "行的分润比例 必须大于 第" + row1[3] + "行的分润比例." ;
				}
				if(parseFloat($.trim(row1[1])) != parseFloat($.trim(row2[0]))){
					return "第" + (row2[3]) + "行的区间最小金额 必须等于 第" + row1[3] + "行的区间最大金额.";
				}
			}
		}
	}
	
</script>
</head>
<body>	
			<s:form id="profitModuleForm" action="/model/saveModifProfitModule.ct" method="post"  theme="simple"  >
			 <%-- 	<s:hidden name="profitModule.flag" value="%{#request.profitModule.flag}"></s:hidden> --%>
			 	<%-- <s:iterator value="#request.proListOld" status="stat" id="bean">
    				<s:hidden name="athorityValue" value="%{#bean.mccTypeId}" />
   				</s:iterator> --%>
				<table width="100%" class="tb" >
				
			        <tr class="tb-line">
			            <td class="tb-td" colspan="6">
				            <div class="tb-h2">POS收单运营管理平台
						    	<s:hidden name="profitModule.id" value="%{#request.profitModule.id}"/>
						   	<%-- 	<s:hidden name="updateFlag" id="updateFlag" value="%{#request.updateFlag}"/> --%>
						   	</div>
					   	</td>
			        </tr>
	                <tr class="tb-line bg-gray">
			            <td class="tb-td" colspan="4"><div class="tb-h3">代理商模板信息</div></td>
			        </tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">模板名称：</div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-select"><s:property value="#model.moduleName"/>
								<s:textfield maxlength="60" name="profitModule.moduleName" value = "%{#request.profitModule.moduleName}" cssClass="queryWidth"/>
						 	</label>
						 	<font color="red">*</font>
						</td>
					     
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4"></div>
			            </td>
			            <td class="tb-td" >
			             	<label class="tb-input-lengthen">
							</label>
						</td>
					</tr>
					<tr class="tb-line">
				    	<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4">备注：</div>
			            </td>
			            <td class="tb-td" colspan="3" style="height:auto;line-height:auto;" >
			             	<label style="height:auto;line-height:auto;">
			             		<s:textarea rows="5" cssClass="someWidth" value = "%{#request.profitModule.remark}" 
								name="profitModule.remark" maxlength="240"  style="height: 102px; resize: none; width: 530px;padding:0 5px;" />
			             	</label>
			             </td>
					     
					</tr>
			
					</table>
					
					<s:if test="null==#request.mccList||#request.mccList.size==0 ">
						<div style="color: red;">
							扣率配置为空,不能添加分润模板,请联系上级代理商添加扣率配置
						</div>
					</s:if>
					<div class="tab-body" id="tabBody">
				
					    <div class="tab-title bg-gray">
					        <div class="tb-title active">扣率配置</div>
					        <div class="tb-title">分润比例</div>
					    </div>
				
				
				   <div class="tab-cnt">
				   
				   <table class="tb" style="display: block;">
					  <tbody>
					<tr class="tb-line">
						<td colspan="6">
							<table  width="100%">
								<tr class="tb-line">
									<td class="tb-td" >
						        		<div class="tb-h4">成本扣率</div>
						            </td>
									<td class="tb-td" >
						        		<div class="tb-h4">借记卡成本扣率</div>
						            </td>
									<td class="tb-td" >
						        		<div class="tb-h4">借记卡封顶成本金额</div>
						            </td>
									<td class="tb-td" >
						        		<div class="tb-h4">贷记卡成本扣率</div>
						            </td>
									<td class="tb-td" >
						        		<div class="tb-h4">贷记卡最低签扣</div>
						            </td>
								</tr>
								<s:iterator value="#request.mccList" var="a" status="stat">
									<tr class="tb-line">
										<td class="tb-td" >
											<s:checkboxlist name="profitModule.proList[%{#stat.index}].id" list="#{#a.key:''}" 
											 theme="simple" value = "%{#request.checkRuleMap}"></s:checkboxlist>
											<s:property value="#a.value"/>
											<!--hidden-->
											<s:hidden name="profitModule.proList[%{#stat.index}].mccTypeCode" value="%{#a.key}"/>
											<s:hidden name="profitModule.proList[%{#stat.index}].mccTypeName" value="%{#a.value}"/>
										</td>
										<td class="tb-td" >
									    	<label class="tb-input-normal">
												<s:textfield   name="profitModule.proList[%{#stat.index}].profitFee" value="%{#request.profitModule.proList[#stat.index].profitFee}" maxlength="12" />
											</label>
											%
										</td>
										<td class="tb-td" >
									    	<label class="tb-input-normal">
												 <s:if test=" #a.key==\"04\" || #a.key==\"05\" || #a.key==\"06\" || #a.key==\"07\" || #a.key==\"08\" ">
												 	<s:textfield  name="profitModule.proList[%{#stat.index}].maxFee" value="%{#request.profitModule.proList[#stat.index].maxFee}" maxlength="12"   cssStyle="background-color:lightgray;" readonly="true" />
												 </s:if>
												 <s:else>
												 	<s:textfield  name="profitModule.proList[%{#stat.index}].maxFee" value="%{#request.profitModule.proList[#stat.index].maxFee}" maxlength="12" />
												 </s:else>
											</label>
											元
										</td>
										<td class="tb-td" >
									    	<label class="tb-input-normal">
												<s:if test=" #a.key==\"06\" || #a.key==\"07\" || #a.key==\"08\" ">
													<s:textfield  name="profitModule.proList[%{#stat.index}].profitSettleRate" value="%{#request.profitModule.proList[#stat.index].profitSettleRate}" maxlength="12"   cssStyle="background-color:lightgray;" readonly="true" />
												</s:if>
												<s:else>
													<s:textfield  name="profitModule.proList[%{#stat.index}].profitSettleRate" value="%{#request.profitModule.proList[#stat.index].profitSettleRate}" maxlength="12"   />
												</s:else>
											</label>
											%
										</td>
										<td>
									    	<label class="tb-input-normal">
												<s:if test=" #a.key==\"06\" || #a.key==\"07\" || #a.key==\"08\" ">
									    			<s:textfield  name="profitModule.proList[%{#stat.index}].merchantMinFee" value="%{#request.profitModule.proList[#stat.index].merchantMinFee}" maxlength="12"   cssStyle="background-color:lightgray;" readonly="true" />
												</s:if>
												<s:else>
									    			<s:textfield  name="profitModule.proList[%{#stat.index}].merchantMinFee" value="%{#request.profitModule.proList[#stat.index].merchantMinFee}" maxlength="12"   />
												</s:else>
											</label>
											%
										</td>
									</tr>
								</s:iterator>
							</table>
						</td>
					</tr>
					
				</tbody>
			</table>
			
		  <table class="tb" style="display: none;">
		  
				<tbody>
					<tr class="tb-line">
						 <td class="tb-td" colspan="3" align="center">
						 	填写说明:区间内的金额范围请按照从小到大填写,最后一个区间段的最大金额可不填
						 </td>
					</tr>
					<tr class="tb-line">
						<td></td>
					</tr>
					<tr class="tb-line">
						<td colspan="3">
							<table  width="100%">
								<tr class="tb-line">
									<td class="tb-td" >
						            	<div class="tb-h4">区间最小金额</div>
						            </td>
									<td class="tb-td" >
						            	<div class="tb-h4">区间最大金额(含)</div>
						            </td>
									<td class="tb-td" >
						            	<div class="tb-h4">分润比例(0-100)</div>
						            </td>
								</tr>
								
									<s:iterator value="#request.perList" var="b" status="stat2">
									   <tr class="tb-line">
											<td class="tb-td" >
										        <label class="tb-input-normal">
													<s:textfield  name="profitModule.profitPerList[%{#stat2.index}].limitAmt" value="%{#request.profitModule.profitPerList[#stat2.index].limitAmt}" maxlength="15"  />
												</label>
												 <s:if test=" #stat2.index==\"0\" ">
												 	<font color="red">*</font>
												 </s:if>元
											</td>
											<td class="tb-td" >
										        <label class="tb-input-normal">
													<s:textfield  name="profitModule.profitPerList[%{#stat2.index}].maxAmt" value="%{#request.profitModule.profitPerList[#stat2.index].maxAmt}" maxlength="15"  />
												</label>
												 <s:if test=" #stat2.index==\"0\" ">
												 	<font color="red">*</font>
												 </s:if>元
											</td>
											<td class="tb-td" >
										        <label class="tb-input-normal">
													<s:textfield  name="profitModule.profitPerList[%{#stat2.index}].percent" value="%{#request.profitModule.profitPerList[#stat2.index].percent}" maxlength="12"  />
												</label>
												 <s:if test=" #stat2.index==\"0\" ">
												 	<font color="red">*</font>
												 </s:if>%
											</td>
											<td></td>
								       </tr>
									</s:iterator>
								
							</table>
						</td>
					</tr>
					
				</tbody>
			</table>      
		    </div>
		</div>
		<table width="100%" border="0" cellspacing="0" class="table">
			<tr class="tb-line">
				<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
					<span style="color: red;"><s:actionmessage /></span > <span style="color: red;"><s:fielderror
					cssClass="fieldError" /></span>
					<span id="otherError"></span>
				</td>
			</tr>
			<tr class="tb-line">
				<td class="tb-td line-submit" align="center" colspan="4">
			        <label class="tb-input-submit">
			        	<s:submit id="btnAdd" value="保  存"/> 
					</label>
			        <label class="tb-input-submit">
			        	<input type="reset" onclick="back()" value="取  消"/>
					</label>
				</td>
			</tr>
					
		</table>
	</s:form>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			window.location="${rootPath}/model/queryProfitModuleList.ct";
			alert("${request.msg}");
		</script>
	</s:if>
<script type="text/javascript">
$(function () {
    $('#tabBody').on('click', '.tab-title .tb-title', function () {
        var $this = $(this); /// 点击的对象
        var index = $this.index();  // 点击对象的下标

        // 点击的对象添加active，同类对象移除active
        $this.addClass('active').siblings().removeClass('active');

        // 查找与点击对象相同关系的列表显示并隐藏同类对象
        $('#tabBody').find('.tab-cnt .tb').eq(index).show().siblings().hide();
    });
});
</script>
</body>
</html>
